package com.amarsoft.als;

import java.sql.ResultSet;
import java.sql.Statement;

import com.amarsoft.are.ARE;
import com.amarsoft.are.sql.Connection;
import com.amarsoft.are.sql.PooledConnectionFactory;
import com.amarsoft.are.util.CommandLineArgument;
import com.amarsoft.task.TaskRunner;

public class AmarALS
{
    public static final String PROPERTY_TASK_FILE = "TaskFile";
    public static final String DEFAULT_ARE_CONFIG = "etc/are.xml";

    public static void main(String[] paramArrayOfString) throws Exception
    {
        CommandLineArgument localCommandLineArgument = new CommandLineArgument(paramArrayOfString);
        String str1 = localCommandLineArgument.getArgument("are", "etc/are.xml");
        ARE.init(str1);
        PooledConnectionFactory pcf = new PooledConnectionFactory();
        System.out.println(ARE.getProperty("user"));
        /*Connection conn = ARE.getDBConnection("als");
        ResultSet rsData = conn.createStatement().executeQuery("Select * from user_info where loginid='niuxinxing'");
        String sBusinessDate1 = null;
        if (rsData.next())
        {
            sBusinessDate1 = rsData.getString("userid");
            ARE.getLog().info(sBusinessDate1);
        }
        Statement st = rsData.getStatement();
        st.close();
        rsData.close();*/
        String str3 = ARE.getProperty(localCommandLineArgument.getArgument("task", "CarLoan") + PROPERTY_TASK_FILE);
        boolean bool = localCommandLineArgument.getArgument("gui", true);
        int i = 0;
        if (bool)
        {
            i = TaskRunner.runGui(str3);
        }
        else
        {
            i = TaskRunner.runCli(str3);
            System.exit(i);
        }
    }

}
